package com.example.day23.ex05;

import java.util.function.Consumer;

public class ConsumerTest {
    public static void main(String[] args) {
        String[] strArray={"林青霞,30","张曼玉,35","王祖贤,33"};
        printInfo(strArray, str -> System.out.println("姓名：" + str.split(",")[0]), str -> System.out.println(",年龄：" + Integer.parseInt(str.split(",")[1])));
    }
    private static void printInfo(String[] strArray, Consumer<String> c1, Consumer<String> c2) {
        for (String str : strArray) {
            c1.accept(str);
            c2.accept(str);
        }
    }
}
